'''
Created on Aug 28, 2013

@author: loski07@gmail.com
'''

class Tree(object):
    """
    Tree-like data structure to keep a folder/song structure. 
    """

    def __init__(self, root_folder_name = None, subdirs = None, songs = None):
        """
        Constructor of the class to set its attributes
        """
        self.root_folder_name = root_folder_name
        if not songs:
            self.songs = []
        else:
            self.songs = songs
            
        if not subdirs:
            self.subdirs = []
        else:
            self.subdirs = subdirs

    def add_song(self, song):
        """
        Adds a new song to the tree
        """
        self.songs.append(song)
        
    def add_subdir(self, subdir):
        """
        Adds a new subdir (Tree) to the tree
        """
        self.subdirs.append(subdir)
    
    def tag_root(self, name):
        """
        Sets the name of the root folder
        """
        self.root_folder_name = name
        
    def accept(self, visitor):
        """
        """
        visitor.visit(self)

class Song(object):
    """
    Data structure to keep of the songs
    """
    def __init__(self, filename, fullpath = None, order = None, id3 = None):
        """
        Constructor of the class to set its attributes
        """
        self.filename = filename
        self.fullpath = fullpath
        self.order = order
        self.id3 = id3